//
//  HyperlinksButton.m
//  IM_LearningGYDF
//
//  Created by gydf on 16/3/14.
//  Copyright © 2016年 mac. All rights reserved.
//

#import "HyperlinksButton.h"

@implementation HyperlinksButton

- (id)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        
    }
    return self;
}

-(void)setColor:(UIColor *)color{
    lineColor = [color copy];
    [self setNeedsDisplay];
}


- (void) drawRect:(CGRect)rect {
//    CGRect textRect = self.titleLabel.frame;
//    // need to put the line at top of descenders (negative value)
//    CGFloat descender = self.titleLabel.font.descender;
    CGContextRef contextRef = UIGraphicsGetCurrentContext();
    // set to same colour as text
    CGContextSetStrokeColorWithColor(contextRef, self.titleLabel.textColor.CGColor);
    CGContextMoveToPoint(contextRef, 0, [self getView_Height]-1);
    CGContextAddLineToPoint(contextRef, [self getView_Width], [self getView_Height]-1);
    CGContextClosePath(contextRef);
    CGContextDrawPath(contextRef, kCGPathStroke);

}
/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/

@end
